<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>edit page</title>
</head>
<body>
<!--<form action="{% url 'blog:edit_action' %}" method="post">
    {% csrf_token %}
        <input type = "hidden" name = "article_id" value = "{{ article.id | default:'0'}}"/>
        <label>文章标题
            <input type="text" name="title" value = "{{ article.title }}"/>
        </label>
        <br/>
        <label>文章内容
            <input type="text" name="content" value = "{{ article.content }}"/>
        </label>
        <br/>
        <input type="submit" value="提交">
</form>
-->
<form action="{% url 'blog:edit_action' %}" method="post">
    {% csrf_token %}
    {% if article %}
        <input type = "hidden" name = "article_id" value = "{{article.id}}"/>
        <label>文章标题
            <input type="text" name="title" value = "{{ article.title }}"/>
        </label>
        <br/>
        <label>文章内容
            <input type="text" name="content" value = "{{ article.content }}"/>
        </label>
    {% else %}
        <input type = "hidden" name = "article_id" value = "0"/>
        <label>文章标题
            <input type="text" name="title" />
        </label>
        <br/>
        <label>文章内容
            <input type="text" name="content" />
        </label>
        <br/>
    {% endif %}
        <input type="submit" value="提交">
</form>
<br/><br/>
<a href="{% url 'blog:index' %}">返回主页面</a>
</body>
</html>